/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author QUY-THI
 */
@Entity
@Table(name = "TimeTables")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TimeTable.findAll", query = "SELECT t FROM TimeTable t"),
    @NamedQuery(name = "TimeTable.findById", query = "SELECT t FROM TimeTable t WHERE t.id = :id"),
    @NamedQuery(name = "TimeTable.findByStartTime", query = "SELECT t FROM TimeTable t WHERE t.startTime = :startTime"),
    @NamedQuery(name = "TimeTable.findByEndTime", query = "SELECT t FROM TimeTable t WHERE t.endTime = :endTime"),
    @NamedQuery(name = "TimeTable.findByDescription", query = "SELECT t FROM TimeTable t WHERE t.description = :description")})
public class TimeTable implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "StartTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date startTime;
    @Basic(optional = false)
    @Column(name = "EndTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date endTime;
    @Column(name = "Description")
    private String description;
    @JoinColumn(name = "UserID", referencedColumnName = "UserID")
    @ManyToOne
    private Users userID;
    @JoinColumn(name = "LabID", referencedColumnName = "LabID")
    @ManyToOne
    private Lab labID;

    public TimeTable() {
    }

    public TimeTable(Integer id) {
        this.id = id;
    }

    public TimeTable(Integer id, Date startTime, Date endTime) {
        this.id = id;
        this.startTime = startTime;
        this.endTime = endTime;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Users getUserID() {
        return userID;
    }

    public void setUserID(Users userID) {
        this.userID = userID;
    }

    public Lab getLabID() {
        return labID;
    }

    public void setLabID(Lab labID) {
        this.labID = labID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TimeTable)) {
            return false;
        }
        TimeTable other = (TimeTable) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.TimeTable[ id=" + id + " ]";
    }
    
}
